package com.huawei.appgallery.foundation.application.pkgmanage.model.update;

import android.content.ContentValues;
import android.database.Cursor;
import android.database.sqlite.SQLiteStatement;
import android.text.TextUtils;
import com.huawei.appgallery.jsonkit.api.JsonBean;
import com.huawei.appgallery.jsonkit.api.annotation.FieldPrint;
import com.huawei.appgallery.jsonkit.api.annotation.PrintLevel;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Comparator;
import java.util.Date;
import java.util.Locale;
import o.cfr;
import o.cft;
import o.Logger;

public class ApkUpgradeInfo extends JsonBean implements Comparator<ApkUpgradeInfo>, cfr, Serializable {
    public static final int APP_HAVE_UPDATE = 0;
    public static final int APP_MUST_UPDATE = 1;
    public static final int APP_URGENT_NON_UPDATE = 0;
    public static final int APP_URGENT_UPDATE = 1;
    public static final int FROM_PRE_DOWNLOAD = 1;
    public static final int FROM_USER_DOWNLOAD = 0;
    public static final int KEY_APP = 1;
    public static final int NOT_KEY_APP = 0;
    public static final String TABLE_NAME = "ApkUpgradeInfo";
    private static final String TAG = "ApkUpgradeInfo";
    public static final int TARGET_SDK_VERSION = 0;
    public static final int TARGET_SDK_VERSION_LOWER = 1;
    public static final int TYPE_GAME = 1;
    public static final int TYPE_NORMAL = 0;
    public static final int UPGRADE_SAME_SIGNATURE = 0;
    public static final int UPGRADE_UNSAME_SIGNATURE = 1;
    private static SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
    private static final long serialVersionUID = -4268745914522282082L;
    private int apkReadySouce = 0;
    private int btnDisable_;
    private long bundleSize_;
    public int ctype_;
    private String detailId_;
    private String diffSha2_;
    private long diffSize_;
    private String downurl_;
    public String fUrl_;
    private Date formatDate = null;
    private String fullDownUrl_;
    private boolean gameReserved = false;
    public int genShortcutForWebApp_ = 0;
    public String gplinkPkgName_;
    private String hash_;
    private String icon_;
    private String id_;
    private int isCompulsoryUpdate_ = 0;
    private int isGame_ = 0;
    private int isKeyApp_ = 0;
    public int jumpToGpOnGMSDevice_ = 0;
    private int kindId_;
    private int maple_ = 0;
    private String name_;
    @FieldPrint(print = PrintLevel.NOPRINTABLE)
    private String newFeatures_;
    private String nonAdaptDesc_;
    private String nonAdaptIcon_;
    private int nonAdaptType_ = 0;
    private String oldHashCode;
    private String oldMD5Code;
    private int oldVersionCode_;
    private String oldVersionName_;
    private String package_;
    private int packingType_;
    private String price_;
    private String productId_;
    private String releaseDateDesc_;
    private String releaseDate_;
    private int reservedNeedDownload = 1;
    private int sameS_ = 0;
    private String sha256_;
    public int showDisclaimer_;
    private long size_;
    private int targetSdkS_ = 0;
    private int urgentUpdate_;
    private int versionCode_;
    private String version_;
    public int webApp_ = 0;

    public /* synthetic */ int compare(Object obj, Object obj2) {
        return ॱ((ApkUpgradeInfo) obj, (ApkUpgradeInfo) obj2);
    }

    private static Date ͺ(String str) {
        Date parse;
        Throwable th;
        Throwable th2;
        Throwable th3;
        Date date = null;
        try {
            synchronized (format) {
                try {
                    parse = format.parse(str);
                    try {
                    } catch (Throwable th22) {
                        th = th22;
                        date = parse;
                        th3 = th;
                        try {
                            throw th3;
                        } catch (Throwable th32) {
                            th = th32;
                            parse = date;
                            th22 = th;
                        }
                    }
                } catch (Throwable th4) {
                    th32 = th4;
                    throw th32;
                }
            }
        } catch (Throwable th322) {
            th = th322;
            parse = null;
            th22 = th;
            Logger.ˋ("ApkUpgradeInfo", "format Date failed:" + str, th22);
            return parse;
        }
    }

    public int ˎ() {
        return this.reservedNeedDownload;
    }

    public void ˋ(int i) {
        this.reservedNeedDownload = i;
    }

    public boolean ˋ() {
        return ˌ() != null && ˌ().length() > 0;
    }

    public int ॱ(ApkUpgradeInfo apkUpgradeInfo, ApkUpgradeInfo apkUpgradeInfo2) {
        if (apkUpgradeInfo == null || apkUpgradeInfo2 == null) {
            return 0;
        }
        ˎ(apkUpgradeInfo, apkUpgradeInfo2);
        if (apkUpgradeInfo.formatDate == null || apkUpgradeInfo2.formatDate == null) {
            Logger.e("ApkUpgradeInfo", "formatDate Result is Null");
            return 0;
        } else if (apkUpgradeInfo.formatDate.getTime() > apkUpgradeInfo2.formatDate.getTime()) {
            return -1;
        } else {
            if (apkUpgradeInfo.formatDate.getTime() == apkUpgradeInfo2.formatDate.getTime()) {
                return ˋ(apkUpgradeInfo, apkUpgradeInfo2);
            }
            if (apkUpgradeInfo.formatDate.getTime() < apkUpgradeInfo2.formatDate.getTime()) {
                return 1;
            }
            return 0;
        }
    }

    private int ˋ(ApkUpgradeInfo apkUpgradeInfo, ApkUpgradeInfo apkUpgradeInfo2) {
        if (apkUpgradeInfo.apkReadySouce > apkUpgradeInfo2.apkReadySouce) {
            return -1;
        }
        if (apkUpgradeInfo.apkReadySouce < apkUpgradeInfo2.apkReadySouce) {
            return 1;
        }
        if (apkUpgradeInfo.ʼ() > apkUpgradeInfo2.ʼ()) {
            return 1;
        }
        if (apkUpgradeInfo.ʼ() == apkUpgradeInfo2.ʼ()) {
            return 0;
        }
        return -1;
    }

    private void ˎ(ApkUpgradeInfo apkUpgradeInfo, ApkUpgradeInfo apkUpgradeInfo2) {
        if (apkUpgradeInfo.formatDate == null && !TextUtils.isEmpty(apkUpgradeInfo.ॱˎ())) {
            apkUpgradeInfo.formatDate = ͺ(apkUpgradeInfo.ॱˎ());
        }
        if (apkUpgradeInfo2.formatDate == null && !TextUtils.isEmpty(apkUpgradeInfo2.ॱˎ())) {
            apkUpgradeInfo2.formatDate = ͺ(apkUpgradeInfo2.ॱˎ());
        }
    }

    public String ॱ() {
        return this.id_;
    }

    public void ˊ(String str) {
        this.id_ = str;
    }

    public String ˊ() {
        return this.name_;
    }

    public void ॱ(String str) {
        this.name_ = str;
    }

    public String ᐝ() {
        return this.package_;
    }

    public void ˋ(String str) {
        this.package_ = str;
    }

    public String ʻ() {
        return this.oldVersionName_;
    }

    public void ˎ(String str) {
        this.oldVersionName_ = str;
    }

    public String ʽ() {
        return this.version_;
    }

    public long ʼ() {
        return this.diffSize_;
    }

    public String ॱॱ() {
        return this.diffSha2_;
    }

    public String ॱˊ() {
        return this.oldMD5Code;
    }

    public String ˊॱ() {
        return this.oldHashCode;
    }

    public String ͺ() {
        return this.hash_;
    }

    public int ˏॱ() {
        return this.sameS_;
    }

    public int ॱˋ() {
        return this.targetSdkS_;
    }

    public long ʻॱ() {
        return this.size_;
    }

    public void ˋ(long j) {
        this.size_ = j;
    }

    public String ॱˎ() {
        return this.releaseDate_;
    }

    public String ॱᐝ() {
        return this.icon_;
    }

    public void ˏ(String str) {
        this.icon_ = str;
    }

    public int ᐝॱ() {
        return this.oldVersionCode_;
    }

    public int ʿ() {
        return this.versionCode_;
    }

    public void ˏ(int i) {
        this.versionCode_ = i;
    }

    public String ˈ() {
        return this.downurl_;
    }

    public void ʽ(String str) {
        this.downurl_ = str;
    }

    public String ʾ() {
        return this.sha256_;
    }

    public void ᐝ(String str) {
        this.sha256_ = str;
    }

    public String ʽॱ() {
        if (!TextUtils.isEmpty(this.fullDownUrl_) || this.diffSize_ > 0) {
            return this.fullDownUrl_;
        }
        return this.downurl_;
    }

    public void ॱॱ(String str) {
        this.fullDownUrl_ = str;
    }

    public String ʼॱ() {
        return this.newFeatures_;
    }

    public int ˉ() {
        return this.kindId_;
    }

    public int ˊˊ() {
        return this.apkReadySouce;
    }

    public String ˋˊ() {
        return this.releaseDateDesc_;
    }

    public void ˊ(int i) {
        this.apkReadySouce = i;
    }

    public String ˊᐝ() {
        return this.detailId_;
    }

    public void ʼ(String str) {
        this.detailId_ = str;
    }

    public String ˊˋ() {
        return this.price_;
    }

    public String ˌ() {
        return this.productId_;
    }

    public void ˎ(boolean z) {
        this.gameReserved = z;
    }

    public int ˋᐝ() {
        return this.isCompulsoryUpdate_;
    }

    public int ˋˋ() {
        return this.isGame_;
    }

    public int ˎˎ() {
        return this.isKeyApp_;
    }

    public int ˍ() {
        return this.nonAdaptType_;
    }

    public String ˑ() {
        return this.nonAdaptIcon_;
    }

    public String ͺॱ() {
        return this.nonAdaptDesc_;
    }

    public int ˏˏ() {
        return this.btnDisable_;
    }

    public int ˏˎ() {
        return this.maple_;
    }

    public void ˎ(int i) {
        this.maple_ = i;
    }

    public boolean ˋॱ() {
        return false;
    }

    public String ʻ(String str) {
        return cft.ˋ(str, (cfr) this);
    }

    public ContentValues J_() {
        return cft.ॱ(this);
    }

    public void ˋ(SQLiteStatement sQLiteStatement) {
        cft.ˊ(this, sQLiteStatement);
    }

    public void ˋ(Cursor cursor) {
        cft.ˋ((cfr) this, cursor);
    }

    public String t_() {
        return "ApkUpgradeInfo";
    }

    public String K_() {
        return cft.ˎ(this);
    }

    public int ॱʽ() {
        return this.packingType_;
    }

    public void ॱ(int i) {
        this.packingType_ = i;
    }

    public long ـ() {
        return this.bundleSize_;
    }
}
